#!/bin/bash
# run gmm atk automaticlly at 3:00am

ASCEND_PATH="/home/yyd/Ascend/ascend-toolkit"
WORK_DIR="/home/yyd/ATK2.0/gmm-atk-samples"

RUN_TASK_NUM=200
REGEN_JSON="true"

# set_env
source /home/miniconda3/etc/profile.d/conda.sh
conda activate yyd
source ${ASCEND_PATH}/set_env.sh

run_atk() {
    if [ ! -f "result/gmm/json/all_gmm.json" -o ${REGEN_JSON}=="true" ]; then
        atk case -f gmm.yaml -p generator_ascend_generate_grouped_matmul.py
    fi
    atk node --backend pyaclnn --devices 0 node --backend cpu task -c result/gmm/json/all_gmm.json --task accuracy -p executor_function_ascend_grouped_matmul.py -e ${RUN_TASK_NUM}
}

# run atk
cd ${WORK_DIR}/gmm_atk/non_quant/spilitM
run_atk

cd ../quant/splitM
run_atk()

echo ""
echo "#####################################"
echo "GMM ATK TEST FINISHED"
echo "#####################################"
echo ""